package com.kevin.himly.account.from.controller;

import com.kevin.himly.account.from.entity.Account;
import com.kevin.himly.account.from.service.AccountServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import java.math.BigDecimal;

@Controller
public class AccountController {

    @Autowired
    private AccountServiceImpl accountService;


    @RequestMapping("/account/{id}/{transMoney}")
    public String account(@PathVariable("id") Long id,
                          @PathVariable("transMoney") BigDecimal transMoney) {

        Account account = new Account();
        account.setId(id);
        account.setBalance(transMoney);
        accountService.update(account);
        return "true";
    }
}
